function b=ar_compn(a)
%COMPN   Create companion matrix
%        b=compn(a) takes the polynomial a=[a0,a1, .. ap]  and creates 
%        the associated companion matrix 
%                
%             b= [a0 a1 a2 ...  ap-1 ap;
%                  1  0  0         0  0;
%                  0  1  0 ...     0  0;
%                  :               :  :;
%                  0  0  0 ...     1  0];              
%
a=a(:)';
[r,p]=size(a);
b=[eye(p-1);zeros(1,p-1)]';
b=[a;b];